package org.ifilm.service;

import java.util.List;

import org.ifilm.model.Project;
import org.ifilm.model.ProjectComment;
import org.ifilm.model.ProjectRating;
import org.ifilm.model.User;
import org.ifilm.model.UserJobPosting;

/**
 * Project Service interface
 * 
 * @author Mustafa Genc
 *
 */
public interface ProjectService {
	/**
	 * 
	 * @param project
	 * 		project to persist
	 * @return
	 * 		persisted project
	 */
	public Project createProject(Project project);
	
	/**
	 * 
	 * @param id
	 * 		project id
	 * @return
	 * 		returns the associated project
	 */
	public Project getProject(Long id);
	
	/**
	 * 
	 */
	public List<UserJobPosting> searchPostingsByUserType(Integer page, Integer max, List<String> userTypeName);
	
	/**
	 * 
	 * @param page
	 * 		page number to use for pagination
	 * @param max
	 * 		max number per page to use for pagination
	 * @return
	 * 		returns list of projects
	 */
	public List<Project> listProjects(Integer page, Integer max);
	
	/**
	 * @param userId
	 * 		user ID whose projects are listed	 * 
	 * @param page
	 * 		page number to use for pagination
	 * @param max
	 * 		max number per page to use for pagination
	 * @return
	 * 		returns list of projects
	 */
	public List<Project> listUserProjects(Long userId, Integer page, Integer max);
	
	/**
	 * 
	 * @param projectId
	 * 		rated project
	 * @param rater
	 * 		rater user
	 * @return
	 * 		given rate object
	 */
	public ProjectRating getProjectRate(Long projectId, User rater);
	
	/**
	 * 
	 * @param projectRating
	 * 		project rating to persist
	 */
	public void rateProject(ProjectRating projectRating);
	
	public void updateRate(Project project, ProjectRating oldRating, Integer newRate);
	
	public List<ProjectComment> getComments(Long projectId);
	
	public ProjectComment createProjectComment(ProjectComment projectComment);
	
	public List<UserJobPosting> searchByUserDetail(User user);
	
	public void editProject(Project project);

	public User getUserById(Long userId);
}